using System;

namespace Voodoo.Sauce.Internal.Utils
{
	public static class TimeUtils
	{
		public static DateTime? TimeStampToDateTime(int unixTimeStamp)
		{
			if (unixTimeStamp < 0)
			{
				return null;
			}
			return DateTimeOffset.FromUnixTimeSeconds(unixTimeStamp).UtcDateTime;
		}

		public static int NowAsTimeStamp()
		{
			return (int)DateTimeOffset.UtcNow.ToUnixTimeSeconds();
		}

		public static int GetDaysFromSeconds(int seconds)
		{
			return seconds / 86400;
		}
	}
}
